<include file="Public/min-header" />
<div class="wrapper">
	<include file="Public/breadcrumb"/>
	<style type="text/css">
		.navbar{margin-bottom: 0px;}
	</style>
	<section class="content">
       <div class="row">
       		<div class="col-xs-12">
	       		<div class="box">
	             <div class="box-header">
	               	<nav class="navbar navbar-default">
				        <div class="collapse navbar-collapse">
				          <form class="navbar-form form-inline" action="{:U('Goods/goods_list_quyu')}" method="get">
				            <div class="form-group">
				              	<input type="text" name="goods_name" class="form-control" value="{:I('goods_name')}" placeholder="请输产品名称">
				            </div>
							<div class="form-group">
							  <select name="zhuangtai" id="zhuangtai" class="form-control">
							    <option value="">选择状态</option>
							        <option value="1" <?php if(I('zhuangtai')==1)echo ' selected="selected" ';   ?> >未设置区域限制</option>
									<option value="2" <?php if(I('zhuangtai')==2)echo ' selected="selected" ';   ?>>已设置区域限制</option>
							  </select>
							</div>
				            <button type="submit" class="btn btn-primary">查询</button>
				          </form>
				         
				      	</div>
	    			</nav>
	             </div>
	             <div class="box-body">
	           	 <div class="row">
	            	<div class="col-sm-12">
		              <table id="list-table" class="table table-bordered table-striped dataTable">
		                 <thead>
		                   <tr role="row">
		                        
                                 <td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);"></td>
							   <th>ID</th>
							   <th>产品图片</th>
                               <th>产品名称</th>
			                   <th>卖家账号</th>	
                               <th>发布日期</th>
							   <th>状态</th>
		                  	   <th style="text-align: center;">操作</th>
		                   </tr>
		                 </thead>
						<tbody>
                          <foreach name="list" item="vo" key="k" >
                             <tr role="row">
                                 <td class="text-center">
                                    <input type="checkbox" name="selected[]" value="{$vo['goods_id']}">
                                </td>
							 <td>{$vo.goods_id}</td>
							 <td><img width="50" height="50" src="{$vo.original_img}"/></td>
                             <td>{$vo.goods_name}</td>
							<td>{$vo.store_name}</td>
		                     <td>{$vo.on_time|date='Y-m-d',###}</td>
							 <td><?php
							 if(empty($vo['quyu_stop'])){
								 echo '<span style="color:green">无限制</span>';
							 }else{
								 echo '<span style="color:red">有限制</span>';
							 }
							 ?></td>
		                     <td class="text-center">
		                      	<a class="btn btn-info" href="JavaScript:" id="bianji" rel="{$vo.goods_id}" rev="bianji">编辑限制区域</a>
		                      	<a class="btn btn-danger" id="bianji" rel="{$vo.goods_id}" rev="del">清除限制区域</a>
				     		</td>
		                   </tr>
		                  </foreach>
		                   </tbody>
		                 <tfoot>
		                 
		                 </tfoot>
		               </table>
	               </div>
	          </div>
	          <a href="JavaScript:;"  class="btn btn-primary" onclick="plxianzhi()">批量限制</a>
              <div class="row">
                   
              	    <!--<div class="col-sm-6 text-left">-->
              	    <!--	<button class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>-->
              	    <!--</div>-->
                    <div class="col-sm-6 text-right">{$page}</div>		
              </div>
	          </div>
	        </div>
       	</div>
       </div>
   </section>
<script type="text/javascript">
function plxianzhi(){
    var inputs = $('input:checked');
    var ids ="";
    $.each(inputs,function (k,v) {
        if (v.value != ""){
            ids +=   v.value+",";
        }
    });
    ids = ids.slice(0, -1);
	var myrul='/Admin/Goods/goods_bianji_quyus/goods_id/'+ids;//+myrel;
				layer.open({
				  type: 2,
				  title:'编辑限制区域',
				  shadeClose: true, //点击遮罩关闭
				  skin: 'layui-layer-rim', //加上边框
				  area: ['920px', '620px'], //宽高
				  content: myrul
			})
}
$(document).ready(function() {
	$(".box-body #bianji").click(function(){
			var myrel=$(this).attr('rel'),myrev=$(this).attr('rev'),obj=$(this).parent().parent();
			if(myrev=="bianji"){
				var myrul='/Admin/Goods/goods_bianji_quyu/goods_id/'+myrel;//+myrel;
					layer.open({
					  type: 2,
					  title:'编辑限制区域',
					  shadeClose: true, //点击遮罩关闭
					  skin: 'layui-layer-rim', //加上边框
					  area: ['920px', '620px'], //宽高
					  content: myrul
				})
			}else{
				$.post('/Admin/Goods/goods_bianji_quyu',{action:'alldel',goods_id:myrel},function(res){
					layer.msg('清除限制成功！',{icon:6});
					obj.remove();
				})
			}
			
	    });
});
</script>
</div>
</body>
</html>   
